package com.hb.unic.core.context;

import org.springframework.core.env.Environment;

/**
 * 应用配置
 *
 * @since v1.0，2023/8/26 23:17，create by Mr.Huang.
 */
public final class UnicApplicationProperties {

    /**
     * spring的环境对象
     */
    private Environment env;

    /**
     * 构造器注入
     * 
     * @param environment 环境
     */
    public UnicApplicationProperties(Environment environment) {
        env = environment;
    }

    /**
     * 获取属性值
     * 
     * @param name 属性名
     * @return 属性值
     */
    public String get(String name) {
        String propertyValue = env.getProperty(name);
        if (propertyValue != null) {
            return propertyValue;
        }
        return System.getProperty(name);
    }

}
